package xxl.ioc.utils 
{
	import flash.utils.Dictionary;
	import xxl.ioc.reflection.IReflector;
	import xxl.ioc.typedescriptions.TypeDescription;
	/**
	 * ...
	 * @author XXL
	 */
	public class TypeDescriptor 
	{
		public var _descriptionsCache:Dictionary;
		private var _reflector:IReflector;
		
		public function TypeDescriptor(reflector:IReflector, descriptionsCache:Dictionary) 
		{
			_reflector = reflector;
			_descriptionsCache = descriptionsCache;
		}
		
		public function getDescription(type:Class):TypeDescription
		{
			return _descriptionsCache[type] ||= _reflector.describeInjections(type);
		}
		
		public function addDescription(type:Class, description:TypeDescription):void
		{
			_descriptionsCache[type] = description;
		}
		
	}

}